<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/project/ui-res-v3.css">
<link rel="stylesheet" href="css/project/ui-input-v3.css">
<link rel="stylesheet" href="css/project/ui-color-v3.css">
<link rel="stylesheet" href="css/project/style.css">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-img.css?v=202022">
<link rel="stylesheet" href="css/ui-box.css?v=202022">
<link rel="stylesheet" href="css/ui-color.css?v=202022">
<link rel="stylesheet" href="css/lbbbase.css">
<link rel="stylesheet" href="css/zv_common.css">
<style>
    .center{
        margin: 0 auto;
    }
    .w60{width:5.0em;}
    .E5E3E0{background-color:#E5E3E0;}
    .border{
        border: 1px solid #D0CCC7;
    }
    .mb3{margin-bottom:.3em;}
    .img-checkin{
        background-image:url('images/checking-in.png');
        background-size:8.6em;
        
    }
    .img-checkout{
        background-image:url('images/checking-out.png');
        background-size:8.6em;
    }
    .img-check{
        background-image:url('images/checking.png');
        background-size:8.6em;
        
    }
    .uhide {
        display: none !important;
    }
    .pt{padding-top: 3.5em}
    .mt{margin-top: 5em}
    .rds{
         -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-radius: 50px;
    }
</style>
</head>
<body class="um-vp c-wh" ontouchstart>
<div id="page_0" class="up ub ub-ver" tabindex="0">
   
    <!-- 内容 -->
    <div id="content" class="content " style="padding-top: 3em;">
        
        <div class="" >
            <div  class="ub ub-pc img-checkin ub-img tx-c c1  h85  fs11 " ><div id="checkingIn" class="ub-pc w82 h45 rds pt" style="">上班</div></div>
        </div>
        <div class="">
            <div  class="ub ub-pc img-checkout ub-img tx-c c1 h85 mt10 fs11 mt"><div id="checkingOut" class="ub-pc w82 h45 rds pt" style="">下班</div></div>
        </div>
    </div>
    
</div>
<script src="js/appcan.js"></script>
<script src="js/zy_control.js?v=202022"></script>
<script src="js/zy_click.js?v=202022"></script>
<script src="js/jquery-1.11.1.min.js?v=202022"></script>
<script src="js/main.js"></script>
<script>
zy_init();
// var isCheckIn=false;
var userName="";
var dutyDate="";
var actualBegin="";
var actualEnd="";

window.uexOnload = function(type){
    if (!type) {
         // exitreturn();
         // userName='weixinchen';
         userName=localStorage['MU30-lOGIN-USRNAME'];
         h5Location ();
         dutyDate=getDates();
         $("#checkingIn").click(function(){
             // $('#checkingIn').unbind("click");
             // $("#checkingIn").removeClass("img-checkin"); 
             // $("#checkingIn").addClass("img-check");
             subMit(this.id);
             
             // $("#checkingOut").removeClass("img-check"); 
             // $("#checkingOut").addClass("img-checkout"); 
         });
          $("#checkingOut").click(function(){
                     subMit(this.id);
                 });
    };
}; 

function subMit(id)
{
   switch(id)
   {
      case "checkingIn":
            actualBegin=dutyDate+" "+getTimes();
            actualEnd="";
      break;
      case "checkingOut":
            actualBegin="";
            actualEnd=dutyDate+" "+getTimes();
      break;  
   } 
   sendDutyAttendenceFuc(); 
}
//H5定位
function h5Location () {
    if (navigator.geolocation){
        navigator.geolocation.getCurrentPosition(showPosition);
    }else{
        //alert("该浏览器不支持获取地理位置。");
    }
}
//获取经纬度
var longitude;
var latitude;
function showPosition (position) {
     //alert("纬度: " + position.coords.latitude + "/经度: " + position.coords.longitude);
     longitude=position.coords.longitude;
     latitude=position.coords.latitude;
}



var sendDutyAttendence="http://mumobiletest30.ceair.com:8011/11206260/public/DFECIF/sendDutyAttendence?"; 
function sendDutyAttendenceFuc()
{
    Loading(0);
    var Url=sendDutyAttendence+"userName="+userName+"&dutyDate="+dutyDate+"&actualBegin="+actualBegin+"&actualEnd="+actualEnd+"&longitude="+longitude+"&latitude="+latitude;
    // console.log(Url)
    $.ajax({ 
             type: "GET",
             url: Url,
             data:'',
             dataType: "json",
             success: function(json){
                  console.log(JSON.stringify(json));
                  Loading(-1);
                  if(json.status==0)
                  {
                     appcan.window.alert({
                        title:'提示',
                        content:'提交成功！',
                        buttons:'确定'
                     }); 
                  }
             },
             error: function(erro){
                // alert(JSON.stringify(erro));
             }
         });
}
/**
 * 获取日期：年-月-日
 */
function getDates()
{
    var d = new Date();
    var vYear = d.getFullYear();
    var m=d.getMonth() + 1;
    var vMon =m>=10?m: "0"+m;
    var day=d.getDate();
    var vDay =day>=10?day: "0"+day;
    
    return vYear+"-"+vMon+"-"+vDay;
}

/*
 * 获取时间
 */
function getTimes()
{
    var d = new Date();
    var vH=d.getHours();
    vH=vH>=10?vH: "0"+vH;
    var vM=d.getMinutes();
    vM=vM>=10?vM: "0"+vM;
    var vS=d.getSeconds();
    vS=vS>=10?vS: "0"+vS;
    return  vH+":"+vM+":"+vS;
}
</script>
</body>
</html>